package com.qf.before;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 *
 * 环绕增强：前置 + 后置 + 异常
 */
@SuppressWarnings("all")
public class MyAround implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        try {
            System.out.println("前置");
//        调用原始方法
            invocation.proceed();
            System.out.println("后置");
        }catch (Throwable throwable) {
            throwable.printStackTrace();
            System.out.println("异常");
        } finally {
            System.out.println("最终");
        }
        return null;
    }
}
